﻿using B.S.Packaged.ErrorCode;
using B.S.Packaged.WebAPI.Write.Applications.Commands.CompletedfinishedCommand;
using B.S.Packaged.WebAPI.Write.Applications.Commands.CompletedStorageCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Packaged.WebAPI.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CompletedStorageController : ControllerBase
    {

        private readonly IMediator mediator;

        public CompletedStorageController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 完工入库添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddCompletedStorage(AddCompletedStorageCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 完工入库删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelCompletedStorage([FromQuery] DelCompletedStorageCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 完工入库修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateCompletedStorage(UpdateCompletedStorageCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 包装成品完工添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddCompletedfinished(AddCompletedfinishedCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        ///  包装成品完工删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelCompletedfinished([FromQuery] DelCompletedfinishedCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 包装成品完工修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateCompletedfinished(UpdateCompletedfinishedCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
